!function(a){"use strict";function b(a,b,c){for(a=String(a);a.lengthc?c:b>a?b:a}function d(a,b,c,d){for(;a>c;)a-=d;for(;b>a;)a+=d;return a}function e(a){return a.preventDefault(),!1}function f(){window.console&&window.console.log&&window.console.log.apply(window.console,arguments)}function g(a,b,c){c&&a.bind(b+"."+m,c)}function h(a){a.unbind("."+m)}function i(a){var b,c,d="string"==typeof a.source?[a.source]:a.source,e=0,f=[],g=function(){e+=1,"function"==typeof a.progress&&a.progress({loaded:e,total:d.length,percent:Math.round(e/d.length*100)}),e===f.length&&"function"==typeof a.complete&&a.complete(f)};for(b=0;b1048576){if(c=document.createElement("canvas"),!c||!c.getContext||!c.getContext("2d"))return!1;c.width=c.height=1,d=c.getContext("2d"),d.fillStyle="FF00FF",d.fillRect(0,0,1,1),d.drawImage(a,-e+1,0);try{var h=d.getImageData(0,0,1,1).data;return 255===h[0]&&0===h[1]&&255===h[2]}catch(i){return f(i.message,i.stack),!1}}return!1}function k(a){var b=new Image;return b.src=a.src,{width:b.width,height:b.height}}var l=window.SpriteSpin={},m=l.namespace="spritespin",n=["mousedown","mousemove","mouseup","mouseenter","mouseover","mouseleave","dblclick","touchstart","touchmove","touchend","touchcancel","selectstart","gesturestart","gesturechange","gestureend"];l.mods={},l.defaults={source:void 0,width:void 0,height:void 0,frames:void 0,framesX:void 0,lanes:1,module:"360",behavior:"drag",renderer:"canvas",lane:0,frame:0,frameTime:40,animate:!0,reverse:!1,loop:!0,stopFrame:0,wrap:!0,wrapLane:!1,sense:1,senseLane:void 0,orientation:"horizontal",onInit:void 0,onProgress:void 0,onLoad:void 0,onFrame:void 0,onDraw:void 0},l.sourceArray=function(a,c){var d=0,e=0,f=0,g=0,h=c.digits||2;c.frame&&(d=c.frame[0],e=c.frame[1]),c.lane&&(f=c.lane[0],g=c.lane[1]);var i,j,k,l=[];for(i=f;g>=i;i+=1)for(j=d;e>=j;j+=1)k=a.replace("{lane}",b(i,h,0)),k=k.replace("{frame}",b(j,h,0)),l.push(k);return l},l.measureSource=function(a){var b=a.images[0],c=k(b);if(1===a.images.length){if(a.sourceWidth=c.width,a.sourceHeight=c.height,j(b,c)&&(a.sourceWidth/=2,a.sourceHeight/=2),a.framesX=a.framesX||a.frames,!a.frameWidth||!a.frameHeight)if(a.framesX){a.frameWidth=Math.floor(a.sourceWidth/a.framesX);var d=Math.ceil(a.frames*a.lanes/a.framesX);a.frameHeight=Math.floor(a.sourceHeight/d)}else a.frameWidth=c.width,a.frameHeight=c.height}else a.sourceWidth=a.frameWidth=c.width,a.sourceHeight=a.frameHeight=c.height,j(b,c)&&(a.sourceWidth=a.frameWidth=c.width/2,a.sourceHeight=a.frameHeight=c.height/2),a.frames=a.frames||a.images.length},l.resetInput=function(a){a.startX=a.startY=void 0,a.currentX=a.currentY=void 0,a.oldX=a.oldY=void 0,a.dX=a.dY=a.dW=0,a.ddX=a.ddY=a.ddW=0},l.updateInput=function(a,b){void 0===a.touches&&void 0!==a.originalEvent&&(a.touches=a.originalEvent.touches),b.oldX=b.currentX,b.oldY=b.currentY,void 0!==a.touches&&a.touches.length>0?(b.currentX=a.touches[0].clientX,b.currentY=a.touches[0].clientY):(b.currentX=a.clientX,b.currentY=a.clientY),(void 0===b.startX||void 0===b.startY)&&(b.startX=b.currentX,b.startY=b.currentY,b.clickframe=b.frame,b.clicklane=b.lane),b.dX=b.currentX-b.startX,b.dY=b.currentY-b.startY,b.ddX=b.currentX-b.oldX,b.ddY=b.currentY-b.oldY,b.ndX=b.dX/b.width,b.ndY=b.dY/b.height,b.nddX=b.ddX/b.width,b.nddY=b.ddY/b.height},l.updateFrame=function(a,b,e){void 0!==b?a.frame=Number(b):a.animation&&(a.frame+=a.reverse?-1:1),a.animation?(a.frame=d(a.frame,0,a.frames-1,a.frames),a.loop||a.frame!==a.stopFrame||(a.animate=!1,l.stopAnimation(a))):a.frame=a.wrap?d(a.frame,0,a.frames-1,a.frames):c(a.frame,0,a.frames-1),void 0!==e&&(a.lane=e,a.lane=c(a.lane,0,a.lanes-1)),a.target.trigger("onFrame",a),a.target.trigger("onDraw",a)},l.stopAnimation=function(a){a.animation&&(window.clearInterval(a.animation),a.animation=null)},l.setAnimation=function(a){l.stopAnimation(a),a.animate&&(a.animation=window.setInterval(function(){try{l.updateFrame(a)}catch(b){}},a.frameTime))},l.setModules=function(b){var c,d,e;for(c=0;c"),"canvas"===d.renderer){var e=a("")[0];e.getContext&&e.getContext("2d")?(d.canvas=a(e),d.context=e.getContext("2d"),c.append(d.canvas),c.addClass("with-canvas")):d.renderer="image"}d.target=c,d.stage=c.find(".spritespin-stage"),c.data(m,d)}"string"==typeof d.source&&(d.source=[d.source]),(d.behavior||d.module)&&(d.mods=[],d.behavior&&d.mods.push(d.behavior),d.module&&d.mods.push(d.module),delete d.behavior,delete d.module),l.boot(d)},l.destroy=function(a){a&&(l.stopAnimation(a),h(a.target),a.target.removeData(m))},l.registerModule=function(b,c){return l.mods[b]&&a.error("Module name is already taken: "+b),c=c||{},l.mods[b]=c,c},l.Api=function(a){this.data=a},l.extendApi=function(b){var c,d=l.Api.prototype;for(c in b)b.hasOwnProperty(c)&&(d[c]?a.error("API method is already defined: "+c):d[c]=b[c]);return d},a.fn.spritespin=function(b){return"data"===b?this.data(m):"api"===b?new l.Api(this.data(m)):"destroy"===b?a(this).each(function(){l.destroy(a(this).data(m))}):"object"==typeof b?(b.target=b.target||a(this),l.create(b),b.target):a.error("Invalid call to spritespin")}}(window.jQuery||window.Zepto||window.$),function(){"use strict";var a=window.SpriteSpin;a.extendApi({isPlaying:function(){return null!==this.data.animation},isLooping:function(){return this.data.loop},toggleAnimation:function(){this.data.animate=!this.data.animate,a.setAnimation(this.data)},stopAnimation:function(){this.data.animate=!1,a.setAnimation(this.data)},startAnimation:function(){this.data.animate=!0,a.setAnimation(this.data)},loop:function(b){return this.data.loop=b,a.setAnimation(this.data),this},currentFrame:function(){return this.data.frame},updateFrame:function(b){return a.updateFrame(this.data,b),this},skipFrames:function(b){var c=this.data;return a.updateFrame(c,c.frame+(c.reverse?-b:+b)),this},nextFrame:function(){return this.skipFrames(1)},prevFrame:function(){return this.skipFrames(-1)},playTo:function(b,c){var d=this.data;if(c=c||{},c.force||d.frame!==b){if(c.nearest){var e=b-d.frame,f=b>d.frame?e-d.frames:e+d.frames,g=Math.abs(e)g}return d.animate=!0,d.loop=!1,d.stopFrame=b,a.setAnimation(d),this}}})}(window.jQuery||window.Zepto||window.$),function(a,b){"use strict";function c(c){var d=a(this),e=d.data("spritespin");b.updateInput(c,e);var f,g;"horizontal"===e.orientation?(f=e.target.innerWidth()/2,g=e.currentX-e.target.offset().left):(f=e.target.innerHeight()/2,g=e.currentY-e.target.offset().top),g>f?d.spritespin("next"):d.spritespin("prev")}b.registerModule("click",{mouseup:c,touchend:c})}(window.jQuery||window.Zepto||window.$,window.SpriteSpin),function(a,b){"use strict";function c(c){var d=a(this).spritespin("data");b.updateInput(c,d),d.dragging=!0}function d(){var c=a(this),d=c.spritespin("data");b.resetInput(d),d.dragging=!1}function e(c){var d,e,f,g,h=a(this),i=h.spritespin("data");if(i.dragging){b.updateInput(c,i);var j=0;j="number"==typeof i.orientation?(Number(i.orientation)||0)*Math.PI/180:"horizontal"===i.orientation?0:Math.PI/2;var k=Math.sin(j),l=Math.cos(j),m=i.ndX*l-i.ndY*k,n=i.ndX*k+i.ndY*l;d=m*i.frames*i.sense,e=n*i.lanes*(i.senseLane||i.sense),g=Math.floor(i.clickframe+d),f=Math.floor(i.clicklane+e),b.updateFrame(i,g,f),i.animate=!1,b.stopAnimation(i)}}b.registerModule("drag",{mousedown:c,mousemove:e,mouseup:d,mouseleave:d,touchstart:c,touchmove:e,touchend:d,touchcancel:d}),b.registerModule("move",{mousemove:function(a){c.call(this,a),e.call(this,a)},mouseleave:d,touchstart:c,touchmove:e,touchend:d,touchcancel:d})}(window.jQuery||window.Zepto||window.$,window.SpriteSpin),function(a,b){"use strict";function c(c){var d=a(this),e=d.spritespin("data");b.updateInput(c,e),e.onDrag=!0,d.spritespin("animate",!0)}function d(){var c=a(this),d=c.spritespin("data");b.resetInput(d),d.onDrag=!1,c.spritespin("animate",!1)}function e(c){var d=a(this),e=d.spritespin("data");if(e.onDrag){b.updateInput(c,e);var f,g;"horizontal"===e.orientation?(f=e.target.innerWidth()/2,g=(e.currentX-e.target.offset().left-f)/f):(f=e.height/2,g=(e.currentY-e.target.offset().top-f)/f),e.reverse=0>g,g=0>g?-g:g,e.frameTime=80*(1-g)+20}}b.registerModule("hold",{mousedown:c,mousemove:e,mouseup:d,mouseleave:d,touchstart:c,touchmove:e,touchend:d,touchcancel:d,onFrame:function(){var b=a(this);b.spritespin("animate",!0)}})}(window.jQuery||window.Zepto||window.$,window.SpriteSpin),function(a,b){"use strict";function c(c){var d=a(this),e=d.spritespin("data");b.updateInput(c,e),e.onDrag=!0}function d(){var c=a(this),d=c.spritespin("data");d.onDrag=!1,b.resetInput(d)}function e(c){var d=a(this),e=d.spritespin("data");if(e.onDrag){b.updateInput(c,e);var f,g,h=e.frame,i=e.snap||.25;"horizontal"===e.orientation?(f=e.dX,g=e.target.innerWidth()*i):(f=e.dY,g=e.target.innerHeight()*i),f>g?(h=e.frame-1,e.onDrag=!1):-g>f&&(h=e.frame+1,e.onDrag=!1),d.spritespin("update",h),d.spritespin("animate",!1)}}b.registerModule("swipe",{mousedown:c,mousemove:e,mouseup:d,mouseleave:d,touchstart:c,touchmove:e,touchend:d,touchcancel:d})}(window.jQuery||window.Zepto||window.$,window.SpriteSpin),function(a,b){"use strict";function c(b){var c=b.lane*b.frames+b.frame,d=b.frameWidth*(c%b.framesX),f=b.frameHeight*e(c/b.framesX);return"canvas"===b.renderer?(b.context.clearRect(0,0,b.width,b.height),b.context.drawImage(b.images[0],d,f,b.frameWidth,b.frameHeight,0,0,b.width,b.height),void 0):(d=-e(d*b.scaleWidth),f=-e(f*b.scaleHeight),"background"===b.renderer?b.stage.css({"background-image":["url('",b.source[0],"')"].join(""),"background-position":[d,"px ",f,"px"].join("")}):a(b.images).css({top:f,left:d}),void 0)}function d(b){var c=b.lane*b.frames+b.frame;"canvas"===b.renderer?(b.context.clearRect(0,0,b.width,b.height),b.context.drawImage(b.images[c],0,0,b.width,b.height)):"background"===b.renderer?b.stage.css({"background-image":["url('",b.source[c],"')"].join(""),"background-position":[0,"px ",0,"px"].join("")}):(a(b.images).hide(),a(b.images[c]).show())}var e=Math.floor;b.registerModule("360",{onLoad:function(b,c){var d,f;if(c.scaleWidth=c.width/c.frameWidth,c.scaleHeight=c.height/c.frameHeight,c.sourceIsSprite=1===c.images.length,c.stage.empty().css({"background-image":"none"}).show(),"canvas"===c.renderer)c.context.clearRect(0,0,c.width,c.height),c.canvas.show();else if("background"===c.renderer){c.sourceIsSprite?(d=e(c.sourceWidth*c.scaleWidth),f=e(c.sourceHeight*c.scaleHeight)):(d=e(c.frameWidth*c.scaleWidth),f=e(c.frameHeight*c.scaleHeight));var g=[d,"px ",f,"px"].join("");c.stage.css({"background-repeat":"no-repeat","-webkit-background-size":g,"-moz-background-size":g,"-o-background-size":g,"background-size":g})}else"image"===c.renderer&&(c.sourceIsSprite?(d=e(c.sourceWidth*c.scaleWidth),f=e(c.sourceHeight*c.scaleHeight)):d=f="100%",a(c.images).appendTo(c.stage).css({width:d,height:f,position:"absolute"}))},onDraw:function(a,b){b.sourceIsSprite?c(b):d(b)}})}(window.jQuery||window.Zepto||window.$,window.SpriteSpin),function(a){"use strict";var b=window.SpriteSpin.mods.gallery={};b.onLoad=function(b,c){c.images=[],c.offsets=[],c.stage.empty(),c.speed=500,c.opacity=.25,c.oldFrame=0;var d,e=0;for(d=0;d");c.stage.append(f),c.images.push(f),c.offsets.push(-e+(c.width-f[0].width)/2),e+=f[0].width,f.css({opacity:.25})}c.stage.css({width:e}),c.images[c.oldFrame].animate({opacity:1},c.speed)},b.onDraw=function(a,b){b.oldFrame!==b.frame&&b.offsets?(b.stage.stop(!0,!1),b.stage.animate({left:b.offsets[b.frame]},b.speed),b.images[b.oldFrame].animate({opacity:b.opacity},b.speed),b.oldFrame=b.frame,b.images[b.oldFrame].animate({opacity:1},b.speed)):b.stage.css({left:b.offsets[b.frame]+b.dX})},b.resetInput=function(a,b){b.onDrag||b.stage.animate({left:b.offsets[b.frame]})}}(window.jQuery||window.Zepto||window.$),function(a,b){"use strict";var c=Math.floor;b.registerModule("panorama",{onLoad:function(a,b){b.stage.empty().show(),b.frames=b.sourceWidth,"horizontal"===b.orientation?(b.scale=b.height/b.sourceHeight,b.frames=b.sourceWidth):(b.scale=b.width/b.sourceWidth,b.frames=b.sourceHeight);var d=c(b.sourceWidth*b.scale),e=c(b.sourceHeight*b.scale),f=[d,"px ",e,"px"].join("");b.stage.css({"background-image":["url('",b.source[0],"')"].join(""),"background-repeat":"repeat-both","-webkit-background-size":f,"-moz-background-size":f,"-o-background-size":f,"background-size":f})},onDraw:function(a,b){var d=0,e=0;"horizontal"===b.orientation?d=-c(b.frame%b.frames*b.scale):e=-c(b.frame%b.frames*b.scale),b.stage.css({"background-position":[d,"px ",e,"px"].join("")})}})}(window.jQuery||window.Zepto||window.$,window.SpriteSpin);